package etnorservice.etnor_service.mapper;

import etnorservice.etnor_service.domain.po.BlockedIp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface BlockedIpMapper {
    @Select("SELECT EXISTS(SELECT 1 FROM blocked_ips WHERE ip_address = #{ipAddress})")
    boolean existsByIpAddress(String ipAddress);

    @Insert("INSERT INTO blocked_ips (ip_address, blocked_at) VALUES (#{ipAddress}, NOW())")
    void insertBlockedIp(BlockedIp blockedIp);
}